package com.andy.entity;
// default package
// Generated 2016-10-6 23:59:49 by Hibernate Tools 4.0.0.Final

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * ExamScore generated by hbm2java
 */
@Entity
@Table(name = "exam_score")
public class ExamScore implements java.io.Serializable {

	private static final long serialVersionUID = -1891905340354325418L;
	private Integer id;
	private String userId;
	private int subjectId;
	private Date examTime;
	private BigDecimal score;

	public ExamScore() {
	}

	public ExamScore(String userId, int subjectId, Date examTime) {
		this.userId = userId;
		this.subjectId = subjectId;
		this.examTime = examTime;
	}

	public ExamScore(String userId, int subjectId, Date examTime, BigDecimal score) {
		this.userId = userId;
		this.subjectId = subjectId;
		this.examTime = examTime;
		this.score = score;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)

	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "user_id", nullable = false, length = 10)
	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Column(name = "subject_id", nullable = false)
	public int getSubjectId() {
		return this.subjectId;
	}

	public void setSubjectId(int subjectId) {
		this.subjectId = subjectId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "exam_time", nullable = false, length = 19)
	public Date getExamTime() {
		return this.examTime;
	}

	public void setExamTime(Date examTime) {
		this.examTime = examTime;
	}

	@Column(name = "score", precision = 5)
	public BigDecimal getScore() {
		return this.score;
	}

	public void setScore(BigDecimal score) {
		this.score = score;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ExamScore other = (ExamScore) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

}
